#ifndef __APPLICATION_H__
#define __APPLICATION_H__

#include "sweety_App.h"
#include <string>

namespace SW
{
	typedef struct GlfwWindowImplData_t GlfwWindowImplData;

	class SwSceneMenu;
	class FrameBuffer;

	class SW_API Application : public SW::SwApp
	{
	public:
							Application();
							Application(int w, int h, const std::string& title);
		virtual				~Application();

		static Application* GetInstance();

		void				SetBackGroundColor(const SwVec4& color);

		SwVec2				GetInitializationSize() const;

		SwSceneMenu*		GetSceneMenu() {
			return m_SceneMenu;
		}

		static FrameBuffer* GetFramebuffer() {
			return (GetInstance()->m_Framebuffer);
		}

	protected:
		virtual bool		Init()			override;
		virtual	void		MessageLoop()	override;

	private:
		bool				InitGlfw();
		bool				InitSwGui();
		void				DeInitGlfw();
		void				DeInitSwGui();

		void				ResetSwGui();

		void				Render();
		void				RenderSwGui();
		void				RenderSwGuiBegin();
		void				RenderSwGuiEnd();

		void				UpdateTime();
		void				Update();

	private:
		GlfwWindowImplData* m_MainWindowData{ nullptr };
		SwSceneMenu*		m_SceneMenu{ nullptr };
		FrameBuffer*		m_Framebuffer{ nullptr };

		float				m_LastTime;
		float				m_CurrentTime;
		float				m_DeltaTime;
	};
}

#endif

